package com.xyy.saas.payment.pojo.convert;

import com.xyy.ec.order.backend.order.query.dto.OrderDto;
import com.xyy.saas.payment.dao.model.PayFinanceRefundPlan;

import java.util.ArrayList;
import java.util.List;

public class PayFinanceRefundPlanConvert {

    public static List<PayFinanceRefundPlan> convertList(List<OrderDto> list) {
        List<PayFinanceRefundPlan> result = new ArrayList<>();
        for (OrderDto orderDto : list) {
            PayFinanceRefundPlan plan = new PayFinanceRefundPlan();
            plan.setBusinessPayerId(orderDto.getMerchantId()+"");
            plan.setPayerName(orderDto.getMerchantName());
            plan.setBusinessReceiverId(orderDto.getOrgId());
            plan.setReceiverName(orderDto.getCompanyName());
            plan.setBusinessPayNo(orderDto.getOrderNo());
            plan.setPayNo(orderDto.getTargetOrderId());
            result.add(plan);
        }
        return result;
    }

    public static PayFinanceRefundPlan convert(OrderDto orderDto) {
        PayFinanceRefundPlan plan = new PayFinanceRefundPlan();
        plan.setBusinessPayerId(orderDto.getMerchantId()+"");
        plan.setPayerName(orderDto.getMerchantName());
        plan.setBusinessReceiverId(orderDto.getOrgId());
        plan.setReceiverName(orderDto.getCompanyName());
        plan.setBusinessPayNo(orderDto.getOrderNo());
        plan.setPayNo(orderDto.getTargetOrderId());
        return plan;
    }
}
